package com.mz.ozy.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jude.rollviewpager.adapter.StaticPagerAdapter;
import com.mz.ozy.bean.HomeBean;
import com.mz.ozy.widget.BannerImage;

import java.util.List;


/**
 */

public class BannerAdapter extends StaticPagerAdapter {
Context context;
    List<HomeBean.BannerListBean> mBannerListBeans;
    public BannerAdapter(Context context, List<HomeBean.BannerListBean> mBannerListBeans) {
        this.context = context;
        this.mBannerListBeans = mBannerListBeans;


    }
    @Override
    public View getView(ViewGroup container, int position) {
        HomeBean.BannerListBean dataItem = mBannerListBeans.get(position);
        BannerImage bannerImage = new BannerImage(container.getContext());
        bannerImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
        Glide.with(container.getContext()).load(dataItem.getImgPath()).into(bannerImage);
        return bannerImage;
    }
    @Override
    public int getCount() {
        return mBannerListBeans.size();
    }

}
